<?php

/**
 * Booking filter form base class.
 *
 * @package    playcafebookings
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseBookingFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'booking_datetime'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'subject_firstname'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'subject_lastname'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'subject_gender'      => new sfWidgetFormChoice(array('choices' => array('' => '', 'Male' => 'Male', 'Female' => 'Female'))),
      'subject_age'         => new sfWidgetFormFilterInput(),
      'contact_firstname'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contact_lastname'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contact_phone'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contact_email'       => new sfWidgetFormFilterInput(),
      'food_datetime'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'guest_count'         => new sfWidgetFormFilterInput(),
      'party_type'          => new sfWidgetFormFilterInput(),
      'party_options'       => new sfWidgetFormFilterInput(),
      'status'              => new sfWidgetFormChoice(array('choices' => array('' => '', 'Submitted' => 'Submitted', 'Confirmed' => 'Confirmed', 'Completed' => 'Completed'))),
      'amount_paid'         => new sfWidgetFormFilterInput(),
      'room'                => new sfWidgetFormFilterInput(),
      'guest_arrived_count' => new sfWidgetFormFilterInput(),
      'notes'               => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'booking_datetime'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'subject_firstname'   => new sfValidatorPass(array('required' => false)),
      'subject_lastname'    => new sfValidatorPass(array('required' => false)),
      'subject_gender'      => new sfValidatorChoice(array('required' => false, 'choices' => array('Male' => 'Male', 'Female' => 'Female'))),
      'subject_age'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'contact_firstname'   => new sfValidatorPass(array('required' => false)),
      'contact_lastname'    => new sfValidatorPass(array('required' => false)),
      'contact_phone'       => new sfValidatorPass(array('required' => false)),
      'contact_email'       => new sfValidatorPass(array('required' => false)),
      'food_datetime'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'guest_count'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'party_type'          => new sfValidatorPass(array('required' => false)),
      'party_options'       => new sfValidatorPass(array('required' => false)),
      'status'              => new sfValidatorChoice(array('required' => false, 'choices' => array('Submitted' => 'Submitted', 'Confirmed' => 'Confirmed', 'Completed' => 'Completed'))),
      'amount_paid'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'room'                => new sfValidatorPass(array('required' => false)),
      'guest_arrived_count' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'notes'               => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('booking_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Booking';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'booking_datetime'    => 'Date',
      'subject_firstname'   => 'Text',
      'subject_lastname'    => 'Text',
      'subject_gender'      => 'Enum',
      'subject_age'         => 'Number',
      'contact_firstname'   => 'Text',
      'contact_lastname'    => 'Text',
      'contact_phone'       => 'Text',
      'contact_email'       => 'Text',
      'food_datetime'       => 'Date',
      'guest_count'         => 'Number',
      'party_type'          => 'Text',
      'party_options'       => 'Text',
      'status'              => 'Enum',
      'amount_paid'         => 'Number',
      'room'                => 'Text',
      'guest_arrived_count' => 'Number',
      'notes'               => 'Text',
    );
  }
}
